package com.haier.nengyuan.myapplication;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by wy on 2017/7/11.
 */

public class MyDateUtil {
    public static String change(long mHaomiao) {
//        HH:mm:ss
        DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date date = new Date(mHaomiao);
        String mS = formatter.format(date);
        return mS;
    }

    public static String changeYMD(long mHaomiao) {
//        HH:mm:ss
        DateFormat formatter = new SimpleDateFormat("yyyy/MM/dd");
        Date date = new Date(mHaomiao);
        String mS = formatter.format(date);
        return mS;
    }

    public static String changeM(long mHaomiao) {
//        HH:mm:ss
        DateFormat formatter = new SimpleDateFormat("MM");
        Date date = new Date(mHaomiao);
        String mS = formatter.format(date);
        return mS;
    }

    public static String changeY(long mHaomiao) {
//        HH:mm:ss
        DateFormat formatter = new SimpleDateFormat("yyyy");
        Date date = new Date(mHaomiao);
        String mS = formatter.format(date);
        return mS;
    }

    public static String changeD(long mHaomiao) {
//        HH:mm:ss
        DateFormat formatter = new SimpleDateFormat("dd");
        Date date = new Date(mHaomiao);
        String mS = formatter.format(date);
        return mS;
    }

    public static String changeH(long mHaomiao) {
//        HH:mm:ss
        DateFormat formatter = new SimpleDateFormat("HH");
        Date date = new Date(mHaomiao);
        String mS = formatter.format(date);
        return mS;
    }

    public static String changeHM(long mHaomiao) {
//        HH:mm:ss
        DateFormat formatter = new SimpleDateFormat("HH:mm");
        Date date = new Date(mHaomiao);
        String mS = formatter.format(date);
        return mS;
    }
}
